<%@page import="Entities.*"%>
<%@page import="Helpers.*"%>
<%@page import="Hibernate.*"%>
<%@page import="java.util.*"%>

<%@include file="../../views/header.jsp" %>
<%@include file="../../views/mainMenu.jsp" %>
<%@include file="../../views/userMenu.jsp" %>
<%@include file="../../views/cntColumnOpen.jsp" %>

 
     <%
        String id = (String) request.getParameter("id");
        String s = (String) request.getParameter("toetsnaam");
        if (s == null) {

          Toetsen toets = thelper.getToets(Integer.parseInt(id));
     %>

    <h3>Bewerken toets</h3>
    <p>U kunt nu uw toets bewerken via deze pagina.</p>


        
<form id="form6" name="form6" class="wufoo leftLabel" method="post" action="webpages/Toetsen/showToets.jsp?id=<%=id%>">

    <ul>
        <li id="1" class="section">
            <h3 id="title8">Toets behorende bij een cursus</h3>
        </li>
        <br />
        <li id="fo6li115" class="complex">
            <label class="desc" id="title115" for="curus">
                Cursus
                <span id="req_115" class="req">*</span>
            </label>
            <div>
                <select id="cursusid" name="cursusid" class="field select addr" tabindex="14" >
                    <%
                        CursusHelper cHelper = new CursusHelper();
                        List<Cursussen> cursussen = cHelper.getcursussen();
                        for (Cursussen cursus : cursussen) {
                     %>
                        <option value="<%=cursus.getId()%>"<% if (toets.getCursusId() == cursus.getId()) { %> selected="selected"<%} %>><%=cursus.getNaam()%></option>
                    <% }%>
                </select>
            </div>
        </li>

        <li id="2" class="complex">
           <label class="desc" id="title117" for="toets">
             Toets <span id="req_117" class="req">*</span>
           </label>
           <span>
              <input id="toetsnaam" name="toetsnaam" type="text" class="field text" size="30"  value="<%=toets.getNaam()%>" />
           </span>
        </li>

        <li id="3" class="complex">
           <label class="desc" id="title118" for="toets">
             Aantal vragen <span id="req_118" class="req">*</span>
           </label>
           <span>
              <input id="aantal_vragen" name="aantal_vragen" type="text" class="field text" size="5"  value="<%=toets.getAantalVragen()%>"/>
           </span>
        </li>


    </ul>
    <br />
    <input name="submit" type="submit" class="btn" tabindex="16" value="Update toets" />
    <a href="webpages/Toetsen/showToetsen.jsp"> <button type="button" class="btn">Terug</button> </a>
    <a href="webpages/ToetsVragen/showToetsVragen.jsp?tid=<%= toets.getId()%>"><button type="button" class="btn">Toetsvragen</button></a>
</form>

 <%
   } else {

            Toetsen toets = thelper.getToets(Integer.parseInt(id));

            toets.setNaam((String) request.getParameter("toetsnaam"));
            toets.setAantalVragen((int) Integer.parseInt(request.getParameter("aantal_vragen")));
            toets.setCursusId((int) Integer.parseInt(request.getParameter("cursusid")));

            thelper.updateToets(toets);

            response.sendRedirect("showToetsen.jsp");
        }
   %>



<div class="fix"></div>
<!--/post-->



<br class="fix" />

<%@include file="../../views/cntColumnRight.jsp" %>
<%@include file="../../views/footer.jsp" %>
